class Money

  def format(*rules)
    rules = rules.flatten

    formatted = if rules.include?(:no_cents)
      sprintf("$%d", cents.to_f / 100  )
    else
      sprintf("$%.2f", cents.to_f / 100  )
    end.commify

    if rules.include?(:with_currency)
      formatted << " "
      formatted << '<span class="currency">' if rules.include?(:html)
      formatted << currency
      formatted << '</span>' if rules.include?(:html)
    end
    formatted
  end

end
